Optimal. Leaf size=136 \[ \frac {x \left (c^3-3 i c^2 d-3 c d^2-3 i d^3\right )}{4 a^2}+\frac {(c+i d)^2 (3 d+i c)}{4 a^2 f (1+i \tan (e+f x))}+\frac {d^3 \log (\cos (e+f x))}{a^2 f}+\frac {(-d+i c) (c+d \tan (e+f x))^2}{4 f (a+i a \tan (e+f x))^2} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.30, antiderivative size = 136, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 28, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.179, Rules used = {3558, 3589, 3475, 3526, 8} \[ \frac {x \left (-3 i c^2 d+c^3-3 c d^2-3 i d^3\right )}{4 a^2}+\frac {(c+i d)^2 (3 d+i c)}{4 a^2 f (1+i \tan (e+f x))}+\frac {d^3 \log (\cos (e+f x))}{a^2 f}+\frac {(-d+i c) (c+d \tan (e+f x))^2}{4 f (a+i a \tan (e+f x))^2} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 3475
Rule 3526
Rule 3558
Rule 3589
Rubi steps
\begin {align*} \int \frac {(c+d \tan (e+f x))^3}{(a+i a \tan (e+f x))^2} \, dx &=\frac {(i c-d) (c+d \tan (e+f x))^2}{4 f (a+i a \tan (e+f x))^2}-\frac {\int \frac {(c+d \tan (e+f x)) \left (-2 a \left (c^2-2 i c d+d^2\right )+4 i a d^2 \tan (e+f x)\right )}{a+i a \tan (e+f x)} \, dx}{4 a^2}\\ &=\frac {(i c-d) (c+d \tan (e+f x))^2}{4 f (a+i a \tan (e+f x))^2}+\frac {i \int \frac {-2 a^2 c \left (2 c d+i \left (c^2+d^2\right )\right )-2 a^2 d \left (i c^2+4 c d+3 i d^2\right ) \tan (e+f x)}{a+i a \tan (e+f x)} \, dx}{4 a^3}-\frac {d^3 \int \tan (e+f x) \, dx}{a^2}\\ &=\frac {d^3 \log (\cos (e+f x))}{a^2 f}+\frac {(c+i d)^2 (i c+3 d)}{4 f \left (a^2+i a^2 \tan (e+f x)\right )}+\frac {(i c-d) (c+d \tan (e+f x))^2}{4 f (a+i a \tan (e+f x))^2}+\frac {\left (c^3-3 i c^2 d-3 c d^2-3 i d^3\right ) \int 1 \, dx}{4 a^2}\\ &=\frac {\left (c^3-3 i c^2 d-3 c d^2-3 i d^3\right ) x}{4 a^2}+\frac {d^3 \log (\cos (e+f x))}{a^2 f}+\frac {(c+i d)^2 (i c+3 d)}{4 f \left (a^2+i a^2 \tan (e+f x)\right )}+\frac {(i c-d) (c+d \tan (e+f x))^2}{4 f (a+i a \tan (e+f x))^2}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] time = 2.42, size = 305, normalized size = 2.24 \[ -\frac {\sec ^2(e+f x) \left (4 i c^3 f x \sin (2 (e+f x))+c^3 \sin (2 (e+f x))+4 i c^3+3 i c^2 d \sin (2 (e+f x))+12 c^2 d f x \sin (2 (e+f x))+\cos (2 (e+f x)) \left (c^3 (4 f x+i)+3 c^2 d (-1-4 i f x)-3 c d^2 (4 f x+i)+8 d^3 \log \left (\cos ^2(e+f x)\right )+d^3 (1+4 i f x)\right )-3 c d^2 \sin (2 (e+f x))-12 i c d^2 f x \sin (2 (e+f x))+12 i c d^2-i d^3 \sin (2 (e+f x))-4 d^3 f x \sin (2 (e+f x))+8 i d^3 \sin (2 (e+f x)) \log \left (\cos ^2(e+f x)\right )+16 d^3 \tan ^{-1}(\tan (f x)) (\sin (2 (e+f x))-i \cos (2 (e+f x)))-8 d^3\right )}{16 a^2 f (\tan (e+f x)-i)^2} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.52, size = 126, normalized size = 0.93 \[ \frac {{\left (16 \, d^{3} e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + {\left (4 \, c^{3} - 12 i \, c^{2} d - 12 \, c d^{2} - 28 i \, d^{3}\right )} f x e^{\left (4 i \, f x + 4 i \, e\right )} + i \, c^{3} - 3 \, c^{2} d - 3 i \, c d^{2} + d^{3} + {\left (4 i \, c^{3} + 12 i \, c d^{2} - 8 \, d^{3}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} e^{\left (-4 i \, f x - 4 i \, e\right )}}{16 \, a^{2} f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 1.14, size = 226, normalized size = 1.66 \[ -\frac {\frac {2 \, {\left (-i \, c^{3} - 3 \, c^{2} d + 3 i \, c d^{2} + d^{3}\right )} \log \left (\tan \left (f x + e\right ) + i\right )}{a^{2}} + \frac {2 \, {\left (i \, c^{3} + 3 \, c^{2} d - 3 i \, c d^{2} + 7 \, d^{3}\right )} \log \left (\tan \left (f x + e\right ) - i\right )}{a^{2}} + \frac {-3 i \, c^{3} \tan \left (f x + e\right )^{2} - 9 \, c^{2} d \tan \left (f x + e\right )^{2} + 9 i \, c d^{2} \tan \left (f x + e\right )^{2} - 21 \, d^{3} \tan \left (f x + e\right )^{2} - 10 \, c^{3} \tan \left (f x + e\right ) + 30 i \, c^{2} d \tan \left (f x + e\right ) - 18 \, c d^{2} \tan \left (f x + e\right ) + 22 i \, d^{3} \tan \left (f x + e\right ) + 11 i \, c^{3} + 9 \, c^{2} d + 15 i \, c d^{2} + 5 \, d^{3}}{a^{2} {\left (\tan \left (f x + e\right ) - i\right )}^{2}}}{16 \, f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [B] time = 0.29, size = 362, normalized size = 2.66 \[ \frac {3 \ln \left (\tan \left (f x +e \right )+i\right ) c^{2} d}{8 f \,a^{2}}-\frac {\ln \left (\tan \left (f x +e \right )+i\right ) d^{3}}{8 f \,a^{2}}-\frac {3 i c^{2} d}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )}+\frac {3 i c \,d^{2}}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )^{2}}+\frac {i \ln \left (\tan \left (f x +e \right )+i\right ) c^{3}}{8 f \,a^{2}}+\frac {5 i d^{3}}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )}+\frac {c^{3}}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )}+\frac {9 c \,d^{2}}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )}+\frac {3 c^{2} d}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )^{2}}-\frac {d^{3}}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )^{2}}-\frac {i \ln \left (\tan \left (f x +e \right )-i\right ) c^{3}}{8 f \,a^{2}}+\frac {3 i \ln \left (\tan \left (f x +e \right )-i\right ) c \,d^{2}}{8 f \,a^{2}}-\frac {3 i \ln \left (\tan \left (f x +e \right )+i\right ) c \,d^{2}}{8 f \,a^{2}}-\frac {i c^{3}}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )^{2}}-\frac {3 \ln \left (\tan \left (f x +e \right )-i\right ) c^{2} d}{8 f \,a^{2}}-\frac {7 \ln \left (\tan \left (f x +e \right )-i\right ) d^{3}}{8 f \,a^{2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: RuntimeError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 5.66, size = 184, normalized size = 1.35 \[ \frac {\mathrm {tan}\left (e+f\,x\right )\,\left (\frac {3\,c^2\,d}{4\,a^2}-\frac {5\,d^3}{4\,a^2}+\frac {c^3\,1{}\mathrm {i}}{4\,a^2}+\frac {c\,d^2\,9{}\mathrm {i}}{4\,a^2}\right )+\frac {c^3}{2\,a^2}+\frac {3\,c\,d^2}{2\,a^2}+\frac {d^3\,1{}\mathrm {i}}{a^2}}{f\,\left ({\mathrm {tan}\left (e+f\,x\right )}^2\,1{}\mathrm {i}+2\,\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (-c^3\,1{}\mathrm {i}-3\,c^2\,d+c\,d^2\,3{}\mathrm {i}+d^3\right )}{8\,a^2\,f}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,\left (c^3\,1{}\mathrm {i}+3\,c^2\,d-c\,d^2\,3{}\mathrm {i}+7\,d^3\right )}{8\,a^2\,f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 1.07, size = 398, normalized size = 2.93 \[ \begin {cases} \frac {\left (\left (16 i a^{2} c^{3} f e^{4 i e} + 48 i a^{2} c d^{2} f e^{4 i e} - 32 a^{2} d^{3} f e^{4 i e}\right ) e^{- 2 i f x} + \left (4 i a^{2} c^{3} f e^{2 i e} - 12 a^{2} c^{2} d f e^{2 i e} - 12 i a^{2} c d^{2} f e^{2 i e} + 4 a^{2} d^{3} f e^{2 i e}\right ) e^{- 4 i f x}\right ) e^{- 6 i e}}{64 a^{4} f^{2}} & \text {for}\: 64 a^{4} f^{2} e^{6 i e} \neq 0 \\x \left (- \frac {c^{3} - 3 i c^{2} d - 3 c d^{2} - 7 i d^{3}}{4 a^{2}} + \frac {i \left (- i c^{3} e^{4 i e} - 2 i c^{3} e^{2 i e} - i c^{3} - 3 c^{2} d e^{4 i e} + 3 c^{2} d + 3 i c d^{2} e^{4 i e} - 6 i c d^{2} e^{2 i e} + 3 i c d^{2} - 7 d^{3} e^{4 i e} + 4 d^{3} e^{2 i e} - d^{3}\right ) e^{- 4 i e}}{4 a^{2}}\right ) & \text {otherwise} \end {cases} + \frac {d^{3} \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{a^{2} f} - \frac {x \left (- c^{3} + 3 i c^{2} d + 3 c d^{2} + 7 i d^{3}\right )}{4 a^{2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________